package homeworkSYX_OODay04;

public class PolymorphicDemo {
    public static void main(String[] args) {
        Animal[] animals = new Animal[3];
        Dog dog = new Dog("小黑","黑",2);
        Chick chick = new Chick("小花","花",1);
        Fish fish = new Fish("小金","金",2);
        animals[0]=dog;
        animals[1]=chick;
        animals[2]=fish;
        Master master = new Master();

        for (int i=0;i<animals.length;i++){
            master.feed(animals[i]);
            if(animals[i] instanceof Swim){
                ((Swim) animals[i]).swim();
            }
            if(animals[i] instanceof Dog){
                ((Dog)animals[i]).lookHome();
            }
            if(animals[i] instanceof Chick){
                ((Chick)animals[i]).layEggs();
            }

        }
        Aoo aoo = r->Math.PI*r*r;
        System.out.println(aoo.calArea(2));
        Aoo aoo2 = r-> {
            double i=1.0;
            return Math.PI * r * r*i;
        };

    }

}
